package com.tea.teawebsite.controller;

import com.tea.teawebsite.entity.Cguser;
import com.tea.teawebsite.mapper.CguserMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class CguserController {

    @Resource
    CguserMapper cguserMapper;

    /*@RequestMapping("/login")
    public String show(){
        //用于实现跳转到login.html页面
        return "hlogin";
    }*/
    @GetMapping("/login")
    public String main(String gname,String gpwd){
        //用于实现跳转到hmain.html页面
        Map<String, Object> columnMap = new HashMap<>();
        columnMap.put("gname", gname);
        columnMap.put("gpwd", gpwd);
        List<Cguser> cgusers = cguserMapper.selectByMap(columnMap);
        System.out.println("cgusers="+cgusers);
        if (cgusers!=null){
            return "登录成功";
        }else{
            return "登录失败";
        }
    }

}
